﻿using Dapper;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Model;
using System.Collections.Generic;
using System.Data.SqlClient;

namespace Repository
{
    public class UserRepository
    {

        public string ConnectionString { get; private set; }

        public UserRepository(IConfiguration configuration)
        {

            ConnectionString = configuration.GetConnectionString("Default");
        }


        public IEnumerable<UserEntity> GetList()
        {
            
            using (var conn = new SqlConnection(this.ConnectionString))
            {
                return conn.Query<UserEntity>("SELECT TOP 10 * FROM T_MGT_User ORDER BY ID DESC");
            }
            
        }
    }
}
